/**
 *  @file
 *  @brief   圆形（ROD）梁截面属性使用解析公式计算类
 *  @author  kangrongyao
 *  @date    2024.03.28
 *  @version v1.0
 *  @par Copyright(c):  ShenGong  Simulation corporation
 */

#include "RodSectionFormulaCalculator.h"
#include "DataStructure/Common/Real.h"
#include "DataStructure/Common/Constant.h"

using SG::DataStructure::Common::Real;
using SG::DataStructure::Common::PI;
using SG::DataStructure::FEM::PBARLData;
using SG::DataStructure::FEM::PBARData;
using SG::FEMSolver::Element::RodSectionFormulaCalculator;

void RodSectionFormulaCalculator::Compute
(
const SG::DataStructure::FEM::PBARLData& section,
_OUT SG::DataStructure::FEM::PBARData&   property,
_OUT SG::Algebra::Point&                 centroid
) const
{
    Real r{section.m_dimension[0]};

    property.m_id  = section.m_id;
    property.m_mId = section.m_mId;
    property.m_A   = PI * r * r;
    property.m_I1  = PI * 0.25 * r * r * r * r;
    property.m_I2  = property.m_I1;
    property.m_I12 = 0.0;
    property.m_J   = property.m_I1 + property.m_I2;
    property.m_K1  = 0.9;
    property.m_K2  = 0.9;
    property.m_NSM = section.m_nsm;
    property.m_FE  = 0.0;
    property.SetStressPoints ({ r,    0.0,
                                0.0,  r,
                               -r,    0.0,
                                0.0, -r});
    centroid.m_x = 0.0;
    centroid.m_y = 0.0;
    centroid.m_z = 0.0;
}